package com.zxy.ziems.server.production.controller;

import com.zxy.ziems.server.production.pojo.param.CustXyhProsalestoreParam;
import com.zxy.ziems.server.production.pojo.vo.CustXyhProjectNameVo;
import com.zxy.ziems.server.production.pojo.vo.CustXyhProsalestoreTotalVO;
import com.zxy.ziems.server.production.pojo.vo.CustXyhProsalestoreVo;
import com.zxy.ziems.server.production.service.CustXyhProsalestoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 产销存看板
 *
 * @Copyright (C),
 * @ClassName: CustXyhProsalestoreController
 * @Author: yanzhiwei
 * @Description:
 * @Date: 2024/5/11 13:48
 */
@RestController
@Validated
@RequestMapping("/api/producion/prosalestore")
public class CustXyhProsalestoreController {

    /**
     * 产销存列表
     *
     * @return
     */
    @PostMapping("/list")
    public List<CustXyhProsalestoreVo> list(@Validated(value = CustXyhProsalestoreParam.Select.class) @RequestBody CustXyhProsalestoreParam custXyhProsalestoreParam) throws Exception {
        return service.getList(custXyhProsalestoreParam);
    }


    /**
     * 查询项目名称列表
     *
     * @return
     */
    @GetMapping("/projectNameList")
    public List<CustXyhProjectNameVo> projectNameList(@Validated(value = CustXyhProsalestoreParam.Select.class) @RequestBody CustXyhProsalestoreParam custXyhProsalestoreParam) {


        return service.projectNameList(custXyhProsalestoreParam.getDate());
    }

    /**
     * 统计原材，库存
     *
     * @return
     */
    @GetMapping("/total")
    public CustXyhProsalestoreTotalVO total() {


        return service.total();
    }


    private CustXyhProsalestoreService service;

    @Autowired
    public void setService(CustXyhProsalestoreService custXyhProsalestoreService) {
        this.service = custXyhProsalestoreService;
    }
}
